//
//  NewsCell.swift
//  NetEasyNew
//
//  Created by 蔡万鸿 on 15/6/6.
//  Copyright (c) 2015年 黄花菜. All rights reserved.
//

import UIKit
import SDWebImage

class NewsCell: UITableViewCell {
    
    @IBOutlet weak var iconView: UIImageView!
    
    @IBOutlet weak var titileLabel: UILabel!

    @IBOutlet weak var digestLabel: UILabel!
    
    @IBOutlet weak var replyLabel: UILabel!
    
    @IBOutlet var extraImages: [UIImageView]!
        
    // 微博数据
    var news: News? {
        didSet {
            titileLabel.text = news?.title
            digestLabel.text = news?.digest
            replyLabel.text = "\(news!.replyCount)"
            
            // 异步加载图像之前，清空图像
            self.iconView.image = nil
            // 设置头像
            iconView.sd_setImageWithURL(news?.iconURL)
            
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        // 设置摘要的换行宽度
        self.digestLabel.preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.size.width - self.digestLabel.frame.origin.x - 20
    }
}
